<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<style type="text/css">
		.box{
			width: 200px;
			height: 200px;
			background: red url() 0 0 no-repeat;
		}
	</style>
	<script type="text/javascript">
		 
		window.onload = function  (argument) {
			var start = document.getElementById('start');

			// var stop = document.getElementById('stop');

			var box = document.getElementById('box');

			var width =200;
			var height =200;

			var c =1;

			function run () {
				if(c==1){
					width +=1;
					height +=1;
					if(width>400){
						c=0;
					}
				}else{
					width -=1;
					height -=1;

					if(width<200){
						c=1;
					}
				}
				
				box.style.width =width+'px';
				box.style.height =height+'px';
			}
			var is =1;
			start.onclick = function  () {

				if(is==1){
					time = setInterval(run, 10);
					start.value ="停止";
					is =0;
				}else{
					clearInterval(time);
					start.value ="开始";
					is =1;
				}
			}

			// stop.onclick = function  () {
			// 	clearInterval(time);
			// }
		}

	</script>
</head>
<body>
	<input type="button" value="开始" id="start">
	<!-- <input type="button" value="停止" id='stop'> -->
	<div class="box" id="box">
		
	</div>
	
</body>
</html>